#define  _CRT_SECURE_NO_WARNINGS


#include<stdio.h>
#include<string.h>

int main()
{
	char arr[201] = { 0 }, a[201] = { 0 };
	gets(arr);
	int len = strlen(arr), i = 0, j = 0, sum = 0, b[201] = { 0 }, k = 0, max = 0;
	for (i = 0, k = 0; i < len;)
	{
		if (arr[i] == arr[i + 1])
		{
			for (j = i + 1, sum = 0; arr[i] == arr[j]; j++)
			{
				sum++;
			}
			a[k] = arr[i];
			b[k] = sum + 1;
			k++;
			i += sum + 1;
		}
		else
			i++;
	}
	for (i = 0, max = 0; i < k; i++)
	{
		if (b[i] > b[max])
			max = i;
	}
	printf("%c %d\n", a[max], b[max]);
	return 0;
}